﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using CLEXA.SurfaceClient.ViewModel;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace CLEXA.SurfaceClient.View
{
    public sealed partial class LatticeView : Page
    {
        private Facade facade;

        public LatticeView()
        {
            this.InitializeComponent();
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            facade = (Facade)e.Parameter;
            var vm = new LatticeVM(facade);
            DataContext = vm;
            vm.NavigateRequested += Vm_NavigateRequested;
        }

        private void Vm_NavigateRequested(Type sourcePageType)
        {
            this.Frame.Navigate(sourcePageType, facade);
        }
    }
}
